import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.wavefront.WavefrontProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.web.multipart.MultipartFile;

@SpringBootTest
@AutoConfigureMockMvc
@ContextConfiguration(classes = WavefrontProperties.Application.class)
public class ImageServersTest {

    @Autowired
    private MockMvc mockMvc;

    @Test
    void imageJpgTest() throws Exception {
        MultipartFile file =
                new MockMultipartFile("file", "test.jpg",
                        "image/jpeg", "Hello World".getBytes());

        mockMvc.perform(MockMvcRequestBuilders.post(
                "/dn/image/internal/api/v1/save", file
        ));
    }

    @Test
    void imagePngTest() throws Exception {
        MultipartFile file =
                new MockMultipartFile("file", "test.png",
                        "image/png", "Hello World".getBytes());

        mockMvc.perform(MockMvcRequestBuilders.post(
                "/dn/image/internal/api/v1/save", file
        ));
    }

}
